import React, { Component } from 'react';
import { Carousel } from 'antd-mobile';
import PropTypes from 'prop-types';

export default class Swiper extends Component {

  static propTypes = {
    // 指定imgList的类型为数组,而且是有字符串组成的数组
    imgList: PropTypes.arrayOf(PropTypes.string)
  }
   render() {
    let { imgList } = this.props;
    return (
      <div className="common-swiper">
        <Carousel
          autoplay={true}
          infinite={true}
        >
          {imgList.map(val => (
              <img className="img"
                src={val}
                key={val}
                style={{height:'2.12rem'}}
                alt="" />
          ))}
        </Carousel>
      </div>
    );
  }
}

